<?php
/**
 * Created by PhpStorm.
 * User: 乌拉
 * Date: 15/8/3
 * Time: 上午11:37
 * 内容信息读取
 */
//读取所属一个id的全部信息
$con=M('content')->where(array('id'=>array('eq',$_GET['id'])))->select();
/*读取所属一个id的视频信息，把字符串更改数组
 * */
$con_video = M('content')->where(array('id' => array('eq',$_GET['id'])))->field('con_video')->select();
$arr_video = array();
for ($i = 0; $i < count($con_video); $i++) {
    $arr_video[] = explode(',', $con_video[$i]['con_video']);
}
/*读取所属一个id 编辑器里面的内容
 * */
$content = M('content')->where(array('id' => array('eq',$_GET['id'])))->field('con_content')->select();
/*读取所属一个id 的内容文件名
 * */
$filename = M('content')->where(array('id' => array('eq',$_GET['id'])))->field('con_file_name')->select();
$con_file = M('content')->where(array('id' => array('eq',$_GET['id'])))->field('con_file')->select();
$arr_file = array();
for ($i = 0; $i < count($con_file); $i++) {
    $arr_file[] = explode(',', $con_file[$i]['con_file']);
}
/*读取所属一个id的文件原名
 * */
$file_old_name = M('content')->where(array('id' => array('eq',$_GET['id'])))->field('file_old_name')->select();
$arr_file_old_name = array();
for ($i = 0; $i < count($file_old_name); $i++) {
    $arr_file_old_name[] = explode(',', $file_old_name[$i]['file_old_name']);
}
/*读取所属一个id 的视频文件原名
 * */
$video_old_name = M('content')->where(array('id' => array('eq',$_GET['id'])))->field('video_old_name')->select();
$arr_video_old_name = array();
for ($i = 0; $i < count($video_old_name); $i++) {
    $arr_video_old_name[] = explode(',', $video_old_name[$i]['video_old_name']);
}
/*读取所属一个id面的内容所属栏目
 * */
$category=M('content')->where(array('id' => array('eq',$_GET['id'])))->field('con_category')->select();
/*读取所属一个id面的内容的标题
 * */
$con_title=M('content')->where(array('id' => array('eq',$_GET['id'])))->field('con_title')->select();
/*读取所属一个id面的内容封面图片
 * */
$con_pic=M('content')->where(array('id' => array('eq',$_GET['id'])))->field('con_pic')->select();
$this->id=$_GET['id'];
$this->category= $category[0]['con_category'];
$this->con_title= $con_title[0]['con_title'];
$this->con_pic= $con_pic[0]['con_pic'];
$this->con=$con;
$this->video=$arr_video[0];
$this->video_old_name=$arr_video_old_name[0];
$this->file=$arr_file[0];
$this->file_old_name=$arr_file_old_name[0];
$this->content=stripslashes($content[0]['con_content']);
$this->file_name=$filename[0]['con_file_name'];